package com.twu.biblioteca;

import java.util.LinkedList;
import java.util.Scanner;

/**
 * Created by medina on 30/09/14.
 */
public class Biblioteca {

    private static Scanner scanner = new Scanner(System.in);

    /**
     * Calls methods to generate list of books, list of movies, and list of users. Calls method to Log In user
     */
    public static void main(String[] args){

        LinkedList<LinkedList> list_books = generateBookList();
        LinkedList<LinkedList> list_movies = generateMovieList();
        LinkedList<LinkedList> list_users = generateUserList();
        BibliotecaApp biblioteca = new BibliotecaApp(list_books, list_movies, list_users);

        biblioteca.tryToLogIn();
    }

    /**
     * Generates list of the books in the library
     * @return list of books
     */
    public static LinkedList<LinkedList> generateBookList(){

        LinkedList<LinkedList> listOfBooks = new LinkedList<LinkedList>();
        LinkedList headList = new LinkedList();
        headList. add("Title");
        headList.add("Author");
        headList.add("Year");
        listOfBooks.add(headList);

        LinkedList list1= new LinkedList();
        list1.add("American Tragedy");
        list1.add("Theodore Dreiser");
        list1.add("1925");
        listOfBooks.add(list1);

        LinkedList list2= new LinkedList();
        list2.add("Atonement");
        list2.add("Ian McEwan");
        list2.add("2001");
        listOfBooks.add(list2);

        LinkedList list3= new LinkedList();
        list3.add("TDD By Example");
        list3.add("Kent Beck");
        list3.add("2003");
        listOfBooks.add(list3);

        LinkedList list4= new LinkedList();
        list4.add("Jane Eyre");
        list4.add("Charlotte Brontë");
        list4.add("1847");
        listOfBooks.add(list4);
        return listOfBooks;
    }

    /**
     * Generates list of movies in the library
     * @return list of movies
     */
    public static LinkedList<LinkedList> generateMovieList(){
        LinkedList<LinkedList> listOfMovies = new LinkedList<LinkedList>();
        LinkedList headList = new LinkedList();
        headList.add("Title");
        headList.add("Year");
        headList.add("Director");
        headList.add("rating");
        listOfMovies.add(headList);

        LinkedList list1= new LinkedList();
        list1.add("The Pursuit of Happyness");
        list1.add("2006");
        list1.add("Gabriele Muccino");
        list1.add("7.9");
        listOfMovies.add(list1);

        LinkedList list2= new LinkedList();
        list2.add("Yes Man");
        list2.add("2008");
        list2.add("Peyton Reed");
        list2.add("6.9");
        listOfMovies.add(list2);

        LinkedList list3= new LinkedList();
        list3.add("The Help");
        list3.add("2011");
        list3.add("Tate Taylor");
        list3.add("8.1");
        listOfMovies.add(list3);

        LinkedList list4= new LinkedList();
        list4.add("Titanic");
        list4.add("1997");
        list4.add("James Cameron");
        list4.add("7.7");
        listOfMovies.add(list4);
        return listOfMovies;
    }

    /**
     * Generates list of users registered in the library
     * @return list of users
     */
    public static LinkedList<LinkedList> generateUserList(){
        LinkedList<LinkedList> list_users = new LinkedList<LinkedList>();
        LinkedList user1 = new LinkedList();
        user1.add("123-456q");
        user1.add("qwerty");
        user1.add("Medina");
        user1.add("r_medina@mail.ru");
        user1.add("07716723942");
        list_users.add(user1);
        LinkedList user2 = new LinkedList();
        user2.add("124-456q");
        user2.add("qwerty");
        user2.add("Tom");
        user2.add("0123456789");
        list_users.add(user2);
        LinkedList user3 = new LinkedList();
        user3.add("125-456q");
        user3.add("qwerty");
        user3.add("Jerry");
        user3.add("9876543210");
        list_users.add(user3);
        return list_users;
    }
}
